<?php
//原型模式prototype
interface Prototype { public function copy();}

class ConcretePrototype implements Prototype{
    private $name;
    public function __construct($name)
    {
        $this->name=$name;
    }
    public function copy()
    {
        // TODO: Implement copy() method.
        return clone $this;
    }
}

class Demo{

}

$demo = new Demo();
$obj = new ConcretePrototype($demo);
$obj2 = $obj->copy();